package com.doupi.partner.service.constant;

/**
 * 用户状态
 * 
 * @author Alvin Wang
 * @version 1.0.0 @ 2017-04-19
 */
public enum AccountStatusEnum {
	NORMAL("正常", Byte.valueOf("1")), LOCKED("二级年费收益", Byte.valueOf("99"));

	private String name;
	private byte code;

	AccountStatusEnum(String name, byte code) {
		this.name = name;
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public byte getCode() {
		return code;
	}

	/**
	 * 根据 code获取AccountStatusEnum
	 *
	 * @param code
	 *            code
	 * @return {@link AccountStatusEnum}
	 */
	public static AccountStatusEnum getAccountStatusByCode(byte code) {
		for (AccountStatusEnum accountStatus : values()) {
			if (code == accountStatus.code) {
				return accountStatus;
			}
		}
		return null;
	}
}
